package org.example.java.base;

public class StaticTest {

  public static class A {
    private String a;

    public String getA() {
      return a;
    }

    public void setA(String a) {
      this.a = a;
    }
  }

  public class B {
    private String b;

    public String getB() {
      return b;
    }

    public void setB(String b) {
      this.b = b;
    }
  }

  //static class is like static method first you should create out class instance ,
  // than you can invoke the class or method
  private static void testStaticClass() {
    A a = new A();
    B b = new StaticTest().new B();
    StaticTest t = new StaticTest();
    A aa = new A();
    B bb = t.new B();
    a.setA("aa");
    b.setB("bb");
    System.out.println(a);
    System.out.println(b);
    System.out.println(aa);
    System.out.println(bb);
  }

  public static void main(String[] args) {
//    testStaticClass();

    // ... the code being measured ...
    StaticA a1 = new StaticA();
    StaticA a2 = new StaticA();
    System.out.println(a1);
    System.out.println(a2);
  }

  static class StaticB {
    String b;
  }

  static class StaticA {
    static int i = 0;
    final int id = i++;
    static StaticB b = new StaticB();

    @Override
    public String toString() {
      System.out.print(id + " " + b);
      System.out.println(" " + Thread.currentThread());
      return super.toString();
    }
  }
}
